/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.capex.farmacus.encapsulates;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author IK
 */
@Entity
@Table(name = "centrosmedicos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Centrosmedicos.findAll", query = "SELECT c FROM Centrosmedicos c"),
    @NamedQuery(name = "Centrosmedicos.findById", query = "SELECT c FROM Centrosmedicos c WHERE c.id = :id"),
    @NamedQuery(name = "Centrosmedicos.findByNombreCentro", query = "SELECT c FROM Centrosmedicos c WHERE c.nombreCentro = :nombreCentro"),
    @NamedQuery(name = "Centrosmedicos.findByTelefono", query = "SELECT c FROM Centrosmedicos c WHERE c.telefono = :telefono"),
    @NamedQuery(name = "Centrosmedicos.findByDireccion", query = "SELECT c FROM Centrosmedicos c WHERE c.direccion = :direccion"),
    @NamedQuery(name = "Centrosmedicos.findByCiudad", query = "SELECT c FROM Centrosmedicos c WHERE c.ciudad = :ciudad")})
public class Centrosmedicos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "nombreCentro")
    private String nombreCentro;
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "direccion")
    private String direccion;
    @Column(name = "ciudad")
    private String ciudad;
    @JoinTable(name = "medicoscentrosmedicos", joinColumns = {
        @JoinColumn(name = "centrosmedicos", referencedColumnName = "id")}, inverseJoinColumns = {
        @JoinColumn(name = "medico", referencedColumnName = "id")})
    @ManyToMany
    private List<Medicos> medicosList;

    public Centrosmedicos() {
    }

    public Centrosmedicos(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombreCentro() {
        return nombreCentro;
    }

    public void setNombreCentro(String nombreCentro) {
        this.nombreCentro = nombreCentro;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getCiudad() {
        return ciudad;
    }

    public void setCiudad(String ciudad) {
        this.ciudad = ciudad;
    }

    @XmlTransient
    public List<Medicos> getMedicosList() {
        return medicosList;
    }

    public void setMedicosList(List<Medicos> medicosList) {
        this.medicosList = medicosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Centrosmedicos)) {
            return false;
        }
        Centrosmedicos other = (Centrosmedicos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.capex.farmacus.encapsulates.Centrosmedicos[ id=" + id + " ]";
    }
    
}
